package com.mall.demo.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.mall.demo.entity.OrderList;
import com.mall.demo.mapper.OrderMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.annotation.Order;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/Order")
public class OrderController {
    @Autowired
    private OrderMapper orderMapper;

    @PostMapping("/addOneOrder")
    @CrossOrigin
    public  void addOrder(@RequestBody OrderList orderList){
        int insert = orderMapper.insert(orderList);
    }

    @GetMapping("/getorder")
    @CrossOrigin
    public List<OrderList> getorder(String uid){
        QueryWrapper<OrderList> wrapper = new QueryWrapper<>();
        wrapper.eq("uid" , uid);
        List<OrderList> orderLists = orderMapper.selectList(wrapper);
        return orderLists;
    }
}
